USE [Finances]
GO
/****** Object:  Table [dbo].[transactions]    Script Date: 09/14/2008 22:00:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[transactions](
	[transaction_id] [uniqueidentifier] ROWGUIDCOL  NOT NULL CONSTRAINT [DF_transactions_transaction_id]  DEFAULT (newid()),
	[transactions_status_id] [char](3) NOT NULL,
	[account_id] [uniqueidentifier] NOT NULL,
	[description] [varchar](255) NOT NULL,
	[amount] [decimal](18, 2) NOT NULL,
	[create_date] [datetime] NOT NULL CONSTRAINT [DF_transactions_create_date]  DEFAULT (getdate()),
	[statement_date] [datetime] NULL,
 CONSTRAINT [PK_transactions] PRIMARY KEY CLUSTERED 
(
	[transaction_id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[transactions]  WITH CHECK ADD  CONSTRAINT [FK_transactions_accounts] FOREIGN KEY([account_id])
REFERENCES [dbo].[accounts] ([account_id])
GO
ALTER TABLE [dbo].[transactions] CHECK CONSTRAINT [FK_transactions_accounts]
GO
ALTER TABLE [dbo].[transactions]  WITH CHECK ADD  CONSTRAINT [FK_transactions_transactions] FOREIGN KEY([transactions_status_id])
REFERENCES [dbo].[transactions_status] ([transactions_status_id])
GO
ALTER TABLE [dbo].[transactions] CHECK CONSTRAINT [FK_transactions_transactions]